import request from '@/utils/request'
import { encryptionData } from '@/utils/com'
import Qs from 'qs'

/* 字典管理-列表 */
export function getDictList(data) {
  return request({
    url: '/jcdPub/dict/page',
    method: 'get',
    headers: encryptionData(data, '/dict/page'),
    params: data
  })
}

/* 字典管理-删除 */
export function delDict(data) {
  return request({
    url: `/jcdPub/dict/delete/${data.id}/${data.type}`,
    method: 'DELETE',
    headers: encryptionData({}, `/dict/delete/${data.id}/${data.type}`),
  })
}

/* 字典管理-详情 */
export function getDictDetail(data) {
  return request({
    url: `/jcdPub/dict/get/${data.id}`,
    method: 'get',
    headers: encryptionData({}, `/dict/get/${data.id}`),
    // params: data
  })
}

/* 字典管理-添加 */
export function addDict(data) {
  return request({
    url: '/jcdPub/dict/save',
    method: 'post',
    headers: encryptionData(data, '/dict/save'),
    data: Qs.stringify(data)
  })
}

/* 字典管理-修改 */
export function updateDict(data) {
  return request({
    url: '/jcdPub/dict/update',
    method: 'PUT',
    headers: encryptionData(data, '/dict/update'),
    data: Qs.stringify(data)
  })
}

/* 版本管理-列表 */
export function getVersionList(data) {
  return request({
    url: '/jcdSys/version/list',
    method: 'get',
    headers: encryptionData(data, '/version/list'),
    params: data
  })
}

/* 版本管理-删除 */
export function delVersion(data) {
  return request({
    url: `/jcdSys/version/delete/${data.id}`,
    method: 'DELETE',
    headers: encryptionData({}, `/version/delete/${data.id}`),
  })
}

/* 版本管理-详情 */
export function getVersionDetail(data) {
  return request({
    url: `/jcdSys/version/get/${data.id}`,
    method: 'get',
    headers: encryptionData({}, `/version/get/${data.id}`),
    // params: data
  })
}

/* 版本管理-添加 */
export function addVersion(data) {
  return request({
    url: '/jcdSys/version/save',
    method: 'post',
    headers: encryptionData(data, '/version/save'),
    data: Qs.stringify(data)
  })
}

/* 版本管理-修改 */
export function updateVersion(data) {
  return request({
    url: '/jcdSys/version/update',
    method: 'PUT',
    headers: encryptionData(data, '/version/update'),
    data: Qs.stringify(data)
  })
}
